package jp.co.showbiz.common.base;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.apache.log4j.Logger;

/**
 * クラス概要<br>
 * クラス説明<br>
 * 
 * @author 金赫
 * @version $Revision: 1.1 $
 */
public abstract class BaseBean {
	protected Logger logger = Logger.getLogger(this.getClass().getName());

	public void tostring() throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
			InvocationTargetException {
		Field[] fields = this.getClass().getDeclaredFields();
		int count = 1;
		for (int i = 0; i < fields.length; i++) {
			String fieldName = fields[i].getName().substring(0, 1).toUpperCase()
					+ fields[i].getName().substring(1, fields[i].getName().length());
			Method method = this.getClass().getMethod("get" + fieldName, new Class[] {});
			Object obj = method.invoke(this, new Object[] {});
			String value = String.valueOf(obj);
			logger.debug("FieldName="+method.getName()+" value="+value);
			count += 1;
		}

	};

}
